
#pragma once
#include "CxType.h"
#include "CxImgProc.h"

BEGIN_NAMESPACE(ImgProcPart)

class  CxImgProc_Imp_01 :public CxImgProc
{

public :

	explicit CxImgProc_Imp_01(IplImage *pImage):m_Background(pImage),
		chargeoutcar(0),chargeincar(0),incar_num(0),outcar_num(0),
		flaga(0),flagb(0),incar(0),outcar(0),inNum(0),outNum(0),in_num(0),out_num(0)
	{
		m_pTempImage=NULL;
		a[0]=0;a[1]=0;
		b[0]=0;b[1]=0;
	}

public:
	int      HandleImage(IplImage *pImage,int *_incar,int *_outcar );
private:
	void     GrayDifference(IplImage *pImage);
		
	void     Dilation(BYTE* pColorData,int width,int height);
	void     Erosion(BYTE* pColorData,int width,int height);
	void     Threshold(BYTE *pData,int  width,int  height); 
	int      Judge(int  Width,int Height);

private:

	int        a[2],b[2];
	int         chargeoutcar,chargeincar;
	int        incar_num,outcar_num;
	int         flaga,flagb;
	int         incar,outcar;
	int         in_num,out_num;	
	int         inNum,outNum;


	IplImage		*m_Background;
	IplImage		*m_pTempImage;
};


END_NAMESPACE 